import React from 'react'
import { Navigate } from 'react-router-dom'

import Login from '../../papes/Login'
import NavPage from '../../papes/NavPape'
import NotFound from '../../papes/NotFound'
import Home from '../../papes/Home'


const User = React.lazy(() => import('../../papes/system/user'))
const Role = React.lazy(() => import('../../papes/system/role'))
const Menu = React.lazy(() => import('../../papes/system/menu'))
const Dict = React.lazy(() => import('../../papes/system/dict'))
const Profile = React.lazy(() => import('../../papes/profile'))

const oneKey = localStorage.subTwoKey
const TwoKey = localStorage.oneKye

export const routes = [
    {
        path: '/',
        element: <Navigate to="login" replace />
    },
    {
        path: '/login',
        element: <Login />
    },
    {
        path: '/home',
        element: <NavPage />,
        children: [{
            index: true,
            element: <Home />,
        }]
    },
    {
        path: '/profile',
        element: <NavPage />,
        children: [{
            index: true,
            element: <Profile />,
        }]
    },
    {
        path: '/system',
        element: <NavPage />,
        children: [
            {
                path: 'user',
                element: <User />
            },
            {
                path: 'role',
                element: <Role />
            },
            {
                path: 'menu',
                element: <Menu />
            },
            {
                path: 'dict',
                element: <Dict />
            },
        ]
    },
    {
        path: oneKey,
        element: <NavPage />,
        children: [
            {
                path: TwoKey,
                element: <User />
            },
        ]
    },
    {
        path: '*',
        element: <NotFound />
    },

]